<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //改变函数内this指向，js提供了三种方法 call() apply() bind()
        //1.call()
        var o = {
            name:'andy'
        }
        function fn(a,b){
            console.log(this);
            console.log(a+b);
        }
        fn.call(o,1,2);
        function Father(uname,age,sex){
            this.uname=uname;
            this.age=age;
            this.sex=sex;
        }
        function Son(uname,age,sex){
            //Father.call(this,uname,age,sex);
        }
        var son = new Son('刘德华',18,'男');
        console.log(son);
    </script>
</body>
</html>